#
#   Projectile.py
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; version 2 of the License.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   Copyright
#   Author: Salvatore S. Gionfriddo
#   Contributors: 
#   Created: 2007.08.04
#   Last Modified: 2007.08.04
#

from GameObject import TimedGameObject
from Animation import Animation

class Projectile(TimedGameObject):
    
##############
# ANIMATIONS #
##############
    NUM_ANIMATIONS = 2
    
    (THROWN, HIT) = range(NUM_ANIMATIONS)
    
    LEFT = NUM_ANIMATIONS
    
    ###################
    # ANIMATION TABLE #
    ###################
    ANIMATION_TABLE = [
        (THROWN,         'Rock',  1, Animation.NO_KEY_FRAME),
        (HIT,         'Rock',  1, Animation.NO_KEY_FRAME),
        ]

    DEFAULT_ANIMATION = THROWN
    
########
# MISC #
########
    RECT_SIZE = (10, 10)
    TICKS_TO_LIVE = 1*60 #last for 1 second?
    DAMAGE = 10
    
    def __init__(self, start, movement):
        TimedGameObject.__init__(self)
        self.rect.top = start[1]
        self.rect.left = start[0]
        self.currentAnimation = self.THROWN
        self.movement = movement
        self.facing = 0
        self.ticksLeft = Projectile.TICKS_TO_LIVE
        self.update()
        
    def getType(self):
        return self.getAnimationType()

    def update(self):
        self.rect.left += self.movement[0]
        self.rect.top += self.movement[1]
        TimedGameObject.update(self)
